from django.db import models
from utils.base_model import BaseModel


class ReportModel(BaseModel):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=200, verbose_name='该名称', help_text='测试报告', unique=True)
    result = models.IntegerField(verbose_name='执行结果(0-pass、1-fail)', help_text='执行结果(0-pass、1-fail)', default=0)
    count = models.IntegerField(verbose_name='用例总数', help_text='用例总数')
    success = models.IntegerField(verbose_name='成功总数', help_text='成功总数')
    fail = models.IntegerField(verbose_name='失败总数', help_text='失败总数')
    error = models.IntegerField(verbose_name='错误总数', help_text='错误总数')
    skip = models.IntegerField(verbose_name='跳过总数', help_text='跳过总数')
    path = models.TextField(verbose_name='报告路径', help_text='报告路径', null=True, blank=True, default='')
    content = models.TextField(verbose_name='html报告源码', help_text='html报告源码', null=True, blank=True, default='')
    summary = models.TextField(verbose_name='报告详情', help_text='报告详情', null=True, blank=True, default='')
    is_delete = models.IntegerField(verbose_name="逻辑删除(0-未删除、1-删除)", help_text="逻辑删除(0-未删除、1-删除)",
                                    default=0)

    class Meta:
        db_table = "dtp_report"
        verbose_name = "测试报告"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
